﻿namespace EFS.EventLog.Loggers
{
	/// Class StringList
	public sealed class Logger : EFS.EventLog.Loggers.ILogger
	{
		/// Property Instance (singleton): Get
		public static Logger Instance { get; private set; }

		/// <summary>
		/// Static constructor to init local instance
		/// </summary>
		static Logger()
		{
			Instance = new Logger();
		}

		/// <summary>
		/// Contructor
		/// </summary>
		private Logger()
		{
		}

		/// <summary>
		/// Send message
		/// </summary>
		/// <param name="messageText"></param>
		/// <param name="file"></param>
		/// <param name="email"></param>
		/// <param name="console"></param>
		public void Add(System.String messageText, System.Boolean file, System.Boolean email, System.Boolean console)
		{
			if (null != messageText)
			{
				// file
				if (file)
				{
					EFS.EventLog.Writers.File.Instance.Write(messageText);
				}

				// email
				if (email)
				{
					EFS.EventLog.Writers.Email.Instance.Write(messageText);
				}

				// console email
				if (console)
				{
					EFS.EventLog.Writers.Console.Instance.Write(messageText);
				}
			}
		}
	}
}
